from sqlalchemy import Column, Integer, ForeignKey, PrimaryKeyConstraint, BigInteger
from sqlalchemy.orm import relationship
from models.base import Base
metadata = Base.metadata

class SysUserRole(Base):
    __tablename__ = 'sys_user_roles'
    user_id = Column(BigInteger, ForeignKey('sys_users.id'), primary_key=True, comment='用户ID')
    role_id = Column(Integer, ForeignKey('sys_roles.id'), primary_key=True, comment='角色ID')

    __table_args__ = (
        PrimaryKeyConstraint('user_id', 'role_id'),
    )


    def __repr__(self):
        return f"<SysRoleMenu(role_id={self.user_id}, menu_id={self.role_id})>"
